{% extends "base.volt" %}

{% block pageHeader %}
{{ stylesheet_link("/libs/bootstrap-daterangepicker/daterangepicker.css", false) }}
{% endblock %}

{% block pageFooter%}
    {{ javascript_include("/js/area.js", false) }}
    {{ javascript_include("/libs/bootstrap-daterangepicker/moment.min.js", false) }}
    {{ javascript_include("/libs/bootstrap-daterangepicker/daterangepicker.js", false) }}
    {{ javascript_include("/assets/manage/js/user/list.js", false) }}
{% endblock %}

{% block content %}
{{ partial("module/left_user") }}
    <div class="col-xs-10" >
        <ol class="breadcrumb">
            <li><a href="{{ url.get('user/list') }}">用户管理</a></li>
            <li class="active">用户列表</li>
        </ol>
        <div class="panel panel-default">
            <div class="panel-body">
                <form class="form-inline" role="form" action="" method="get">
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon" for="filterName">用户昵称:</label>
                            <input type="hidden" name="type" value="{{ type }}" />
                            <input class="form-control input160" type="text" name="filterName" id="filterName" value="{{ filterName|escape_attr }}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon" for="filterMobile">账户:</label>
                            <input class="form-control input160" type="text" name="filterMobile" id="filterMobile" value="{{ filterMobile|escape_attr }}" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon" for="filterState">状态:</label>
                            <select class="form-control" name="filterState" id="filterState">
                                <option value="-10000" {{ filterState == -10000 ? 'selected="selected"' : '' }} >全部</option>
                                <option value="1" {{ filterState == 1 ? 'selected="selected"' : '' }} >正常</option>
                                <option value="-1" {{ filterState == -1 ? 'selected="selected"' : '' }} >删除</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon" for="filterGender">性别:</label>
                            <select class="form-control" name="filterGender" id="filterGender">
                                <option value="-10000" {{ filterGender == -10000 ? 'selected="selected"' : '' }} >全部</option>
                                <option value="0" {{ filterGender == 0 ? 'selected="selected"' : '' }} >未知</option>
                                <option value="1" {{ filterGender == 1 ? 'selected="selected"' : '' }} >男</option>
                                <option value="2" {{ filterGender == 2 ? 'selected="selected"' : '' }} >女</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon" for="filterExpert">专家:</label>
                            <select class="form-control" name="filterExpert" id="filterExpert">
                                <option value="-10000" {{ filterExpert == -10000 ? 'selected="selected"' : '' }} >全部</option>
                                <option value="1" {{ filterExpert == 1 ? 'selected="selected"' : '' }} >专家</option>
                                <option value="0" {{ filterExpert == 0 ? 'selected="selected"' : '' }} >非专家</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon">省</label>
                            <select class="form-control" name="filterProvince" id="filterProvince" dvalue="{{ filterProvince|escape_attr }}">
                                <option value="">全部</option>
                            </select>
                            <label class="input-group-addon">市</label>
                            <select class="form-control" name="filterCity" id="filterCity" dvalue="{{ filterCity|escape_attr }}">
                                <option value="">全部</option>
                            </select>
                            <label class="input-group-addon">区/县</label>
                            <select class="form-control" name="filterDistrict" id="filterDistrict" dvalue="{{ filterDistrict }}">
                                <option value="-10000">全部</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <label class="input-group-addon" for="filterExpert">注册时间:</label>
                            <input type="text" class="form-control" id="activity_time" name="regTime" value="{{ regTime }}" style="width:320px;" readonly>
                        </div>
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary"><i class="fa fa-filter"></i> 搜 索</button>
                    </div>
                </form>
            </div>
        </div>

        <table class="table table-hover">
            <thead>
            <tr>
                <th style="width: 60px;">ID</th>
                <th style="width: 120px;">账户</th>
                <th>昵称</th>
                <!-- <th>个性签名</th> -->
                <th style="width: 60px;">性别</th>
                <th style="width: 60px;">专家</th>
                <th style="width: 160px;">城区</th>
                <th style="width: 120px;">姓名</th>
                <th style="width: 120px;">生日</th>
                <th style="width: 120px;">注册时间</th>
                <th style="width: 60px;">状态</th>
                <th style="width: 200px;"></th>
            </tr>
            </thead>
            {% for d in data %}
                <tr>
                    <td>{{ d.user_id }}</td>
                    <td>{{ d.user_account|e }}</td>
                    <td>{{ d.user_nickname|e }}</td>
                    	
                    <!-- {% if d.persional_sign == null %}
                    	<td>暂无个性签名</td>
                    {% else %}	
                    	<td>{{ d.persional_sign|e }}</td>
                    {% endif %} -->
                    
                    <td>{{ d.user_gender == 1 ? '男' : (d.user_gender == 2 ? '女' : '未知') }}</td>
                    <td>{{ d.user_expert == 1 ? 'Y' : 'N' }}</td>
                    <td>{{ d.district }}</td>
                    <td>{{ d.user_realname }}</td>
                    <td>{{ d.user_birthday }}</td>
                    <td>{{ d.user_addtime }}</td>
                    <td>{{ d.user_state < 1 ? '删除' : '正常' }}</td>
                    <td>
                        <div class="dropdown">
                            <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu{{ d.user_id }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"><i class="fa fa-cogs"></i> 操作 <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" aria-labelledby="dropdownMenu{{ d.user_id }}">
                                <li><a href="javascript:void(0)" class="but_update_password" durl="{{ url.get('user/setPasswd') }}" did="{{ d.user_id }}"><i class="fa fa-pencil fa-fw"></i> 修改密码</a></li>
                                <li role="separator" class="divider"></li>
                                {% if d.is_manage == 1 %}
                                <li><a href="{{ url.get('user/edit') }}?id={{ d.user_id }}"  ><i class="fa fa-pencil fa-fw"></i> 编辑信息</a></li>
                                <li role="separator" class="divider"></li>
                                {% endif %}
                                <li><a href="{{ url.get('user/edit') }}?id={{ d.user_id }}&action=see"  ><i class="fa fa-pencil fa-fw"></i> 查看详情</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="javascript:void(0)" durl="{{ url.get('user/setExpert') }}" did="{{ d.user_id }}" dinfourl="{{ url.get('user/setExpertinfo') }}" dvalue="{{ d.user_expert == 1 ? 0 : 1 }}" dtitle="设置为专家" class="but_set_expert"><i class="fa fa-pencil fa-fw"></i> {{ d.user_expert == 1 ? '取消专家身份' : '设置为专家' }}</a></li>
                                <li role="separator" class="divider"></li>
                                {% if d.user_state == 1 %}
                                    <li><a href="javascript:void(0)" durl="{{ url.get('user/setState') }}" did="{{ d.user_id }}" dstate="-1" class="but_set_state"><i class="fa fa-trash-o fa-fw"></i> 删 除</a></li>
                                {% endif %}
                                {% if d.user_state == -1 %}
                                    <li><a href="javascript:void(0)" durl="{{ url.get('user/setState') }}" did="{{ d.user_id }}" dstate="1" class="but_set_state"><i class="fa fa-reply fa-fw"></i> 恢 复</a></li>
                                {% endif %}
                            </ul>
                        </div>
                    </td>
                </tr>
            {% endfor %}
        </table>

        {{ this.tagNav.page(
        page,
        total,
        limit,
        url.get('user/list', [
            'filterName': filterName,
            'filterMobile': filterMobile,
            'filterState': filterState,
            'filterGender': filterGender,
            'filterExpert': filterExpert,
            'filterProvince': filterProvince,
            'filterCity': filterCity,
            'filterDistrict': filterDistrict,
            'regTime':regTime,
            'type':type,
            'page': '__PAGE__'
        ]
        )) }}

    </div>

{% endblock %}